package com.purong.purong.widget;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;


import com.purong.purong.R;
import com.purong.purong.util.CommonUtil;

import java.io.File;

/**
 * Created by wenjiezeng on 2017/10/15.
 */
public class IdentityDialog extends Dialog {
    private Activity mActivity;
    private ImageView img;
    private LinearLayout mainLay;
    public IdentityDialog(Activity context) {
        super(context, R.style.DialogTransparent);
        this.mActivity=context;
        setCanceledOnTouchOutside(false);

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View inflate = LayoutInflater.from(mActivity).inflate(R.layout.dialog_identify_front, null);
        setContentView(inflate);
        img=(ImageView) inflate.findViewById(R.id.img);
        mainLay=(LinearLayout)  inflate.findViewById(R.id.main_lay);
        int width=(int)(CommonUtil.getScreenWidth(mActivity)*0.733)-CommonUtil.dip2px(mActivity,24);
        LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(width, (int)(width*0.92));
        lp.setMargins(CommonUtil.dip2px(mActivity,12),0,CommonUtil.dip2px(mActivity,12),0);
        img.setLayoutParams(lp);

        inflate.findViewById(R.id.confirm).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }


    public void showAfter() {
        super.show();
        img.setImageResource(R.drawable.img_popup_after);

    }

    public void showFront() {
        super.show();
        img.setImageResource(R.drawable.img_popup_front);

    }
    public void showHead() {
        super.show();
        img.setImageResource(R.drawable.img_popup_hand);
    }

}
